package com.zzh.lib.recorder;

import java.io.File;

class Utils {
    public static File createDefaultFileUnderDir(File dir, String ext) {
        if (dir == null)
            return null;

        if (ext == null)
            ext = "";

        try {
            long current = System.currentTimeMillis();
            File file = new File(dir, current + ext);
            while (file.exists()) {
                current++;
                file = new File(dir, current + ext);
            }
            file.createNewFile();
            return file;
        } catch (Exception e) {
            return null;
        }
    }
}
